#include "CSyncPlaybackStream.h"


CSyncPlaybackStream::CSyncPlaybackStream( unsigned int groupid, unsigned int chnmax, DateInfo_Tag tmStart, DateInfo_Tag tmEnd)
{
	m_tmStart = 0;
	m_tmEnd = 0;

	m_groupid = groupid;

	//m_bIsOver = false;

	//m_pMultiSync = new CMultiStreamSyncParser(groupid, chnmax, MSSP_STREAM_BUFFER_SIZE, MSSP_STREAM_BUFFER_FRAME_COUNT);

	//assert( m_pMultiSync != NULL );
}

CSyncPlaybackStream::~CSyncPlaybackStream()
{

	/*if(m_pMultiSync)
	{
		delete m_pMultiSync;
		m_pMultiSync = NULL;
	}*/
}
// return: -1 error, 0 succuss, -2 û�����, -3 ����, -4 ���ڽ���
int CSyncPlaybackStream::GetSyncPlaybackData( unsigned char** ppszBufferFirst, int& iLenFirst,unsigned char** ppszBufferSecond, int& iLenSecond, int& channel, int& formattype, int &freamtype, uint64_t& uPTS, unsigned int& flag,int &chnindex)
{
	int nStatus 		= -1;

	formattype			= 0;
	chnindex			= 0;
	//chnindex 			= m_pMultiSync->GetFrame(ppszBufferFirst, &iLenFirst, ppszBufferSecond, &iLenSecond, &freamtype, &uPTS, &flag, &channel);

	if(chnindex < 0)
	{
		/*if((nStatus = m_pMultiSync->GetStatus()) == 0)
		{
			//m_bIsOver = true;
			return -3;
		}
		else if(nStatus == 1)
		{
			return -4;
		}
		else
		{
			return -1;
		}
		*/
	}

	//m_pMultiSync->ReleaseFrame(chnindex);

	if(iLenFirst + iLenSecond == 0)
	{
		DEBUG_WARNING("------------------------------------\n");
		return -2;
	}
	//DEBUG_WARNING("----flag:[%d]-channel:[%d]---get--data---iLen:[%d]--------\n",flag,channel,iLenFirst + iLenSecond);
	return 0;
}

int CSyncPlaybackStream::ReaseSyncPlaybackFream(const int chnindex)
{
	//m_pMultiSync->ReleaseFrame(chnindex);
	return -1;
}


 int CSyncPlaybackStream::GetChnStatus(int chn)
{
	 return -1;
	//return m_pMultiSync->GetChnStatus(chn);
}


bool CSyncPlaybackStream::IsOver()
{
	return -1;
	//return m_pMultiSync->GetStatus() == 0;
}


